package org.huawei260.String;

import java.util.Scanner;

/**
 * @Auther: qingle
 * @Date: 2024/10/24-17:05
 * @Description:
 * @version: 1.0
 */
public class O0052_翻转单词顺序 {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) { // 检查下一个输入是否是整数
			String str = scanner.nextLine();
			int a = scanner.nextInt(); // 读取第一个整数
			int b = scanner.nextInt(); // 紧接着读取第二个整数
			System.out.println(reverseWords(str,a,b)); //
		}
		scanner.close(); // 使用完毕后关闭Scanner
	}

	private static String reverseWords(String str, int a, int b) {

		String[] strings = str.split(" ");

		String result = "";

		// 数组转字符串
		for (int i = 0; i < a; i++) {
			result += strings[i] + " ";
		}

		for (int i = b; i >= a; i--) {
			result += strings[i] + " ";
		}

		for (int i = b + 1; i <= strings.length - 1; i++) {
			result += strings[i] + " ";
		}

		return result;
	}
}
